﻿using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using StartEAS_API.Utils;
using StartsEAS_API.BLL.Interfaces.IEApplyB;
using StartsEAS_API.Model;

namespace StartsEAS_API.Controllers.EApplyContor
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    [EnableCors("any")]
    public class EApplyController : ControllerBase
    {
        private readonly IEApplyBLL _eApplyBll;
        public EApplyController(IEApplyBLL eApplyBll) { 
            _eApplyBll = eApplyBll;
        }
        /// <summary>
        /// 查询考试申请表信息
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public ResultUtils GetAllEApply() {
            try
            {
                return _eApplyBll.GetAllEApply();
            }
            catch (System.Exception e)
            {
                AppLog.WriteError($"GetAllEApply服务器内部异常：{e}", true);
                return new ResultUtils() { code = 500, message = $"服务器内部异常\n{e.Message}" };
            }
        }
    }
}
